<div class="form" id="itemDialogForm">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'item-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'type'); ?>
		<?php //echo $form->textField($model,'type',array('size'=>60,'maxlength'=>256)); ?>
		<?php echo $form->dropDownList($model,'type',$model->getTypeOptions()); ?>
		<?php echo $form->error($model,'type'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'model'); ?>
		<?php echo $form->textField($model,'model',array('size'=>60,'maxlength'=>256)); ?>
		<?php echo $form->error($model,'model'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'manufacterID'); ?>
		<?php echo $form->textField($model,'manufacterID',array('size'=>60,'maxlength'=>256)); ?>
		<?php echo $form->error($model,'manufacterID'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'status'); ?>
		<?php //echo $form->textField($model,'status',array('size'=>60,'maxlength'=>256)); ?>
		<?php echo $form->dropDownList($model,'status',$model->getStatusOptions()); ?>
		<?php echo CHtml::ajaxLink(Yii::t('job','Create Job'),$this->createUrl('job/addnew'),array(
        'onclick'=>'$("#jobDialog").dialog("open"); return false;',
        'update'=>'#jobDialog'
        ),array('id'=>'showJobDialog'));?>
    <div id="jobDialog"></div>
		<?php echo $form->error($model,'status'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'id_batch'); ?>
		<?php echo $form->textField($model,'id_batch'); ?>
		<?php echo $form->error($model,'id_batch'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'id_unit'); ?>
		<?php echo $form->textField($model,'id_unit'); ?>
		<?php echo $form->error($model,'id_unit'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'notes'); ?>
		<?php echo $form->textArea($model,'notes',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'notes'); ?>
	</div>

	 <div class="row buttons">
        <?php 
			echo CHtml::ajaxSubmitButton(Yii::t('item','Create item'),
			   CHtml::normalizeUrl(array('item/addnew','render'=>false)),
			   array('success'=>'js: function(data) {
					$("#Item_id").append(data);
					$("#itemDialog").dialog("close");
					}'),
			   array('id'=>'closeItemDialog')); 
	   ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->